<template>
    <div>
        <ul class="mui-table-view mui-table-view-chevron" v-for="item in newsList" :key="item.docid">
            <li class="mui-table-view-cell mui-media">
                <router-link to="'/home/newsinfo'+item.docid" class="mui-navigate-right">
                    <img class="mui-media-object mui-pull-left" :src="item.picInfo[0].url">
                    <div class="mui-media-body">
                        <span class="title">{{item.title}}</span>
                        <p class="mui-ellipsis">
                            <span>发表时间:{{item.ptime | dateFormat}}</span>
                        </p>
                    </div>
                </router-link>
            </li>
        </ul>
    </div>
</template>

<script>
    import {Toast} from 'mint-ui'
    export default {
        data(){
            return {
                imgs:[],
                newsList:[]
            }

        },
        created(){
          this.getNewsList()
        },
        methods:{
            getNewsList(){
                this.$http.get("https://www.apiopen.top/journalismApi").then(result=>{
                    if(result.status ===200){
                        this.newsList = result.body.data.tech
                        console.log(result.body.data.tech)
                    }else{
                        Toast("获取新闻数据失败")
                    }
                })
            }
        }
    }
</script>

<style lang="scss" scoped>
    .title{
        font-size: 14px;
    }
    .mui-ellipsis{
        display: flex;
        justify-content: space-between;
    }
</style>